import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock;

public class ConditionDemo {

    public static void main(String[] args) {
        ReentrantLock reentrantLock = new ReentrantLock();
        Condition condition = reentrantLock.newCondition();
        List<String> list = new ArrayList<>(1);

        Thread thread = new Thread(new Consumer(reentrantLock, condition, list), "consumer-thread");
        thread.start();

        Thread thread1 = new Thread(new Producer(reentrantLock, condition, list), "producer-thread");
        thread1.start();
    }

}
